-
Notifications
You must be signed in to change notification settings - Fork 28
feat: add all feature for doc and test
#26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces the --cfg doc hack with a proper all feature flag for documentation building and testing, resolving compatibility issues with crates like quote. The feature allows all architecture-specific modules to be compiled regardless of the target architecture, enabling comprehensive documentation and testing.
Key changes:
- Added
allfeature to bothpage_table_entryandpage_table_multiarchcrates - Removed architecture-specific dependencies that caused cross-compilation issues (
x86_64crate, movedaarch64-cputo dev-dependencies) - Added conditional compilation guards for architecture-specific assembly code to prevent compilation errors when using the
allfeature on non-matching architectures
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| page_table_multiarch/Cargo.toml | Added all feature and removed doc cfg from target dependencies |
| page_table_multiarch/src/arch/mod.rs | Updated module cfg attributes to use feature = "all" instead of doc |
| page_table_multiarch/src/arch/x86_64.rs | Added conditional compilation guards for x86_64-specific TLB flush assembly |
| page_table_multiarch/src/arch/riscv.rs | Added conditional compilation guards for RISC-V-specific TLB flush assembly and inlined helper function |
| page_table_multiarch/tests/alloc_tests.rs | Added cfg attributes to test functions to enable running with all feature |
| page_table_entry/Cargo.toml | Added all feature, removed x86_64 dependency, moved aarch64-cpu to dev-dependencies |
| page_table_entry/src/arch/mod.rs | Updated module cfg attributes to use feature = "all" instead of doc |
| page_table_entry/src/arch/x86_64.rs | Replaced x86_64 crate dependency by defining PTF flags inline using bitflags macro |
| page_table_entry/src/arch/aarch64.rs | Converted MAIR_VALUE from computed constant to hardcoded value with doctest example |
| page_table_entry/README.md | Removed obsolete import of PageTableFlags from x86_64 crate in example |
| Cargo.lock | Removed x86_64 crate and its dependencies from lock file |
| .github/workflows/ci.yml | Updated CI to use --all-features instead of --cfg doc and removed obsolete flags |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Azure-stars Your comments all point to the same issue. My intention was to minimize the use of target-specific dependencies because Cargo's Platform specific dependencies feature doesn't support writing things like |
|
Well, you see it. I tried to add these platform-specific crates back, but these two x86 crates are complaining.
In this respect, |
96c7ae5 to
a935131
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
We previously used the
--cfg dochack for documentation writing and testing. While effective, it wasn't elegant. This resulted in the issue shown in #25, namely incompatibility with crates likequote.This PR adds the
alloptional feature to both crates. It behaves exactly the same as when we used--cfg doc, except for some tweaks to architecture-specific dependency crates to improve compilation.